<?php
/**
 * Created by PhpStorm.
 * User: User
 * Date: 2017/10/9
 * Time: 18:26
 */

class Circle {


    private $r;

    public  function __construct($r){
        $this->r=$r;
    }
    public function __clone(){
        $this->r=10;
    }

    public  function __toString(){
        return'半径为：'.$this->r;
    }
    public  function __call($name, $arguments)
    {
        die("你所调用的方法".$name."不存在");
    }
    public function getArea(){}

    public  function __sleep()
    {

        // TODO: Implement __sleep() method.
    }
    /*  public $r;
      public  function getArea(){
          return 3.14*$this->r*$this->r;
      }

      public function _set($name,$value){
          if($name=='r'&&$value<0){
              $this->r=0;
          }else{
              $this->$name=$value;
          }
      }*/
}


$c=new Circle(3);
$str=serialize($c);
//$d=$c;
echo $str;

$d=unserialize($str);
echo '</br>';
var_dump($d);
//$e=$c->getArea();
//echo $e;